package com.yang.myoschina.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yang.myoschina.R;

/**
 * Created by yangjianquan on 2016/11/7.
 */

public class Myfragment extends Fragment {

    private int mPage;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPage = getArguments().getInt("args_page");
    }

    public static Myfragment newInstance(int page) {
        Bundle args = new Bundle();
        args.putInt("args_page", page);
        Myfragment fragment = new Myfragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.myfragment,container,false);

        TextView textView = (TextView) view.findViewById(R.id.textview);
        textView.setText("第"+mPage+"页");

        return view;
    }
}
